{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "c36c05d690c54ec38ff2ebde45574a9a",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Plot(antialias=3, axes=['x', 'y', 'z'], background_color=16777215, fps_meter=False, grid=[0.0, 0.0, 0.0, 1.0, …"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "'''Mark mesh with boundary function.'''\n",
    "from dolfin import *\n",
    "\n",
    "mesh = UnitCubeMesh(5,5,5)\n",
    "V = FunctionSpace(mesh, \"Lagrange\", 1)\n",
    "\n",
    "class left(SubDomain):\n",
    "    def inside(self, x, on_boundary):\n",
    "        return on_boundary and abs(x[0]) < DOLFIN_EPS\n",
    "left = left()\n",
    "\n",
    "tcond = MeshFunction(\"size_t\", mesh, 0)\n",
    "tcond.set_all(0)\n",
    "left.mark(tcond, 1)\n",
    "\n",
    "##################################\n",
    "from vtkplotter.dolfin import plot\n",
    "plot(tcond, cmap='cool', shading='flat')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
